/**
 * @(#)ApkConfigController.java 2016年12月1日
 * Copyright(C) 2016 ZHEXIN IT CO.,LTD. All rights reserved.
 */
package org.jsbd.boss.action;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.jsbd.boss.domian.BaseInfo;
import org.jsbd.boss.domian.channel.TasktimeDto;
import org.jsbd.boss.service.IApkTaskQueryService;
import org.jsbd.boss.service.IBaseInfoService;
import org.jsbd.boss.service.IChannelApkInfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 任务耗时统计
 * 
 * @author <a href="mailto:wangjunbiao@zhexinit.com" >王俊标</a>
 * @version 1.0.0
 */
@Controller
@RequestMapping("/tasktime")
public class TaskTimeController {
	public static final Logger LOGGER = LoggerFactory.getLogger(TaskTimeController.class);

	@Resource
	private IChannelApkInfoService channelApkService;
	@Resource
	private IApkTaskQueryService apkTaskQueryService;
	@Resource
	private IBaseInfoService baseInfoService;

	@RequestMapping(value = "/byBase", method = RequestMethod.GET)
	public String list(Model model) {
		List<BaseInfo> baseInfos = baseInfoService.getAllChannelInfo();
		model.addAttribute("baseInfos", baseInfos);
		return "/tasktime/byBaseList";
	}

	@RequestMapping(value = "/byBase/list", params = "json")
	@ResponseBody
	public Map<String, Object> configPageList() {
		List<TasktimeDto> list = channelApkService.getTasktimeByBaseList();
		Map<String, Object> map = apkTaskQueryService.queryTasktimeByBaseList(list);
		return map;
	}

}
